﻿@using DirectSell.Model.Money
@using Webdiyer.WebControls.Mvc;
@model PageUserGiro
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/User/Views/Shared/UserLayout.cshtml";
}
<!-- APP MAIN ==========-->
<main id="app-main" class="app-main">
    <div class="wrap">
        <section class="app-content">
            <div class="widget">
                <header class="widget-header title2">
                    <h4 class="widget-title">内部转账</h4>
                </header><!-- .widget-header -->
                <hr class="widget-separator">

                <div class="widget-body">
                    <form id="form1" class="form-horizontal">
                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">会员编号</label>
                            <div class="col-sm-5">
                                <input class="form-control" name="UserCode" value="@ViewBag.UserCode" readonly="readonly" type="text" >
                            </div>
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">转账类型</label>
                            <div class="col-sm-5">
                                <select id="select2-demo-1" class="form-control" name="Type" data-plugin="select2">
                                    <option value="0" selected="selected">电子币</option>
                                </select>
                            </div><!-- END column -->
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">互换数量</label>
                            <div class="col-sm-5">
                                <input class="form-control" type="text" required name="Amount" placeholder="请输入互换数量">
                            </div>
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">接收编号</label>
                            <div class="col-sm-5">
                                <input class="form-control" type="text" required name="ReceiveCode" placeholder="请输入接收会员的编号">
                            </div>
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-5">
                                <input class="form-control" type="text" required name="Remark" placeholder="请输入备注">
                            </div>
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">二级密码</label>
                            <div class="col-sm-5">
                                <input class="form-control" type="password"  required name="SecondPassWord" placeholder="请输入二级密码">
                            </div>
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <label for="#" class="col-sm-2 control-label">验证码</label>
                            <div class="col-sm-4">
                                <input class="form-control" name="CheckCode" type="text" required placeholder="请输入验证码">
                            </div>
                            <div class="col-sm-1"><img id="code" src="/User/UserGiro/GetImageValiDateCode" style="width:60px;height:40px;"></div>
                        </div><!-- .form-group -->

                        <div class="form-group">
                            <div class="col-sm-8 text-center">
                                <button type="submit" class="btn btn-info">确认转账</button>
                            </div>
                        </div>
                    </form>
                </div><!-- .widget-body -->
            </div><!-- .widget -->

            <div class="widget">
                <header class="widget-header title2">
                    <h4 class="widget-title">内部转换-转出记录</h4>
                </header><!-- .widget-header -->
                <hr class="widget-separator">
                <div class="widget-body mt15">
                 
                        <div class="text-center p-t-sm p-b-sm">
                            <nav class="page-redcolor">
                                <div id="orders">
                                    <div id="dvCategoryResults">
                                        @Html.Partial("List", Model.UserGiro_1)
                                    </div>
                                    <div style="width:100%;overflow:auto;">
                                        <div style="float:right">Go to page<select id="pib"></select></div>
                                      @Ajax.Pager(Model.UserGiro_1, new PagerOptions
                                 {
                                     PageIndexParameterName = "pageIndex",
                                     ContainerTagName = "ul",
                                     CssClass = "pagination",
                                     PageIndexBoxId = "pib",
                                     Id = "mypager",
                                     CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>",
                                     DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>",
                                     PagerItemTemplate = "<li>{0}</li>"
                                 }).AjaxOptions(a => a.SetUpdateTargetId("orders").EnablePartialLoading())
                                    </div>
                                </div>

                                @*<div id="articles1">
                                    @{Html.RenderPartial("List", Model.UserGiro_1);}
                                        <div style="float:right">Go to page<select id="pib"></select></div>
                                        @Ajax.Pager(Model.UserGiro_1).Options(o => o.SetPagerItemTemplate("{0}&nbsp;")).AjaxOptions(a => a.SetUpdateTargetId("articles1").EnablePartialLoading())
                                    </div>*@
                            </nav>
                        </div>
                      
                    
                </div><!-- .widget-body -->
            </div><!-- .widget -->
            <div class="widget">
                <header class="widget-header title2">
                    <h4 class="widget-title">内部转换-转入记录</h4>
                </header><!-- .widget-header -->
                <hr class="widget-separator">
                <div class="widget-body mt15">
                 
                        <div class="text-center p-t-sm p-b-sm">
                            <nav class="page-redcolor">
                                <div id="orders1">
                                    <div id="dvCategoryResults">
                                        @Html.Partial("List_1", Model.UserGiro_2)
                                    </div>
                                    <div style="width:100%;overflow:auto;">
                                        <div style="float:right">Go to page<select id="pib1"></select></div>
                                    @Ajax.Pager(Model.UserGiro_2, new PagerOptions
                                   {
                                       PageIndexParameterName = "id",
                                       ContainerTagName = "ul",
                                       CssClass = "pagination",
                                       PageIndexBoxId = "pib1",
                                       Id = "mypager",
                                       CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>",
                                       DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>",
                                       PagerItemTemplate = "<li>{0}</li>"
                                   }).AjaxOptions(a => a.SetUpdateTargetId("orders1").EnablePartialLoading())
                                    </div>
                                </div>

                                @*<div id="articles2">
                                @{Html.RenderPartial("List_1", Model.UserGiro_2);}
                                @Ajax.Pager(Model.UserGiro_2, new PagerOptions { PageIndexParameterName = "id", PagerItemTemplate = "{0}&nbsp;" }, 
                               new MvcAjaxOptions { UpdateTargetId = "articles2", EnablePartialLoading = true })
                                </div>*@
                                @section scripts{ @{Html.RegisterMvcPagerScriptResource();}}
                                </nav>
                        </div>
                    
                </div><!-- .widget-body -->
            </div><!-- .widget -->
        </section><!-- #dash-content -->
    </div><!-- .wrap -->
    <!-- APP FOOTER -->
    <div class="wrap p-t-0">
        <footer class="app-footer">
            <div class="clearfix">
                <div class="copyright text-center w100">@DirectSell.Common.Url.CommonConfig.companyName &copy;</div>
            </div>
        </footer>
    </div>
    <!-- /#app-footer -->
</main>
<!--========== END app main -->
<script>
    //点击验证码图片，更换验证码
    $("#code").click(function () {
        $(this).attr("src", "/User/UserGiro/GetImageValiDateCode?time=" + (new Date()).getTime())
    });

    //提交表单
    $('#form1').on('submit', function () {
        layer.confirm('确定提交本次操作?', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            formPost();
        }, function () {
            layer.close();
        });
        event.preventDefault() //阻止form表单默认提交
    })

    function formPost() {
        //加载层
        var index = layer.load(1, {
            shade: [0.1, '#fff']
        });
        $.ajax({
            type: "post",
            url: "/User/UserGiro/Giro",
            data: $('#form1').serialize(),
        }).success(function (message) {
            if (message != '成功') {
                layer.msg(message, { icon: 2 });
            }
            else {
                layer.msg('转账成功', { icon: 1 });
            }
        }).fail(function (err) {
            layer.msg('系统错误,请稍后重试', { icon: 2 });
        })
        layer.close(index)//关闭加载层
    }
    
</script>